module Utils exposing (..)

import Http exposing (Body,Request,expectJson,request)
import Json.Decode as Decode

put : String -> Body -> Decode.Decoder a -> Request a
put url body decoder =
      request
        { method = "PUT"
        , headers = []
        , url = url
        , body = body
        , expect = expectJson decoder
        , timeout = Nothing
        , withCredentials = False
        }

del : String  -> Decode.Decoder a -> Request a
del url decoder =
      request
        { method = "DELETE"
        , headers = []
        , url = url
        , body = Http.emptyBody
        , expect = expectJson decoder
        , timeout = Nothing
        , withCredentials = False
        }